﻿@model EasyMvcBlog.DTO.ArticleDTO
@section CSS
{
    <link rel="stylesheet" href="@Url.Content("~/Themes/Green/Styles/autocomplete.css")" type="text/css" media="screen" />
}
@section Scripts
{
    <script src="@Url.Content("~/Themes/Green/Scripts/jquery.autocomplete.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Themes/Green/Scripts/KindEditor/kindeditor.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Themes/Green/Scripts/KindEditor/lang/zh_CN.js")" type="text/javascript"></script>
    <script type="text/javascript">
        KindEditor.ready(function (K) {
            K.create('textarea[name="Content"]', {
                allowFileManager: true
            });
        });

        $(function () {
            TagAutoComplete();
            @if (!ViewBag.IsNew)
            {
                //加载标签
                foreach (Tag tag in Model.Tags)
                {
                    @:addTag(@tag.Id,'@tag.TagName',false);
                }
            }
        });
    </script>
}
<div class="content-box">
    <div class="content-box-header">
        @if (ViewBag.IsNew)
        {
            <span>新文章</span>
        }
        else
        { 
            <span>编辑文章</span>
        }
    </div>
    @using (Html.BeginForm("NewArticle", "Admin", FormMethod.Post, new { @class = "niceform" }))
    {
        <div class="content-box-content">
            <div style="margin-bottom: 10px;">
                @Html.HiddenFor(model => model.Id)
                @Html.HiddenFor(model => model.CreateTime)
                标题：@Html.TextBoxFor(model => model.Title, new { @class = "easyTextbox", style = "width:95%;" })
            </div>
            <div id="tagContent" style="margin-bottom: 10px;">
                分类：@Html.DropDownListFor(model => model.Category.Id, ViewBag.CategorySelectList as List<SelectListItem>)
                Tags：@Html.TextBox("tbTags", "", new { @class = "easyTextbox", style = "width:25%;" })
            </div>
            <div style="margin-bottom: 10px;">
                游客可见 @Html.CheckBoxFor(model => model.IsVisitorVisible, new { @checked = "checked" })
                &nbsp;&nbsp;
                禁止评论 @Html.CheckBoxFor(model => model.DenyComment)
            </div>
            @Html.TextAreaFor(model => model.Content, new { style = "width:100%;height:550px" })
            <div style="text-align: center; margin-top: 10px;">
                @if (ViewBag.IsNew)
                {
                    <input type="submit" value="创建" class="easyButton" />
                }
                else
                {
                    <input type="submit" value="更新" class="easyButton" />
                }
            </div>
        </div>
    }
</div>
<div class="clear">
</div>
